// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.

@use '~@mozilla-protocol/core/protocol/css/includes/lib' as * with ($font-path: '/media/protocol/fonts', $image-path: '/media/protocol/img');
@use '~@mozilla-protocol/core/protocol/css/templates/multi-column';
@use '~@mozilla-protocol/core/protocol/css/components/logos/wordmark';
@use '~@mozilla-protocol/core/protocol/css/components/logos/wordmark-product-vpn';

@use 'includes/lib' as *;
@use 'components/unsupported-language';

// * -------------------------------------------------------------------------- */
// Horizontal pricing (default)

.c-pricing-main-header {
    margin-bottom: $layout-xl;
    text-align: center;

    .mzp-c-wordmark.mzp-t-product-vpn {
        background-image: url('/media/protocol/img/logos/mozilla/vpn/logo-word-hor.svg');
        background-position: top center;
        margin: 0 auto $spacing-xl;
    }
}

.mozilla-vpn-pricing-page .c-pricing-main-header {
    margin-bottom: 0;
    padding-bottom: 0;
}

.c-pricing-details-heading {
    margin-bottom: $spacing-xl;
    @include font-size($vpn-title-2xs-size);

    @media #{$mq-md} {
        @include font-size($vpn-title-xs-size);
    }
}

.c-pricing-block {
    background: $color-marketing-gray-20;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    margin-bottom: $spacing-2xl;
    padding: $spacing-lg;
}

.c-pricing-block-header {
    position: relative;
}

.c-pricing-block-tag {
    background: $color-vpn-brand-refresh-purple-20;
    border-radius: $border-radius-md;
    color: $color-white;
    display: inline-block;
    font-weight: bold;
    padding: $spacing-xs $spacing-md;
    @include text-body-sm;

    html[lang^='en'] & {
        text-transform: uppercase;
    }

    @media #{$mq-lg} {
        position: absolute;
        top: 0;
        @include bidi(((left, 0, right, auto),));
    }
}

.c-pricing-block-heading {
    border-bottom: 2px solid $color-black;
    padding-bottom: $spacing-xl;
    @include text-title-md;

    @media #{$mq-lg} {
        padding-top: $spacing-2xl;
    }
}

.c-pricing-block-detail {
    .mzp-c-button {
        text-align: center;
        width: 100%;
    }

    .c-guarantee {
        margin: $spacing-sm auto 0;
    }
}

.c-pricing-block-sub-heading {
    margin-bottom: $spacing-2xl;
    @include text-title-xs;
}

.c-pricing-block-saving {
    color: $color-vpn-brand-refresh-blue;
    font-weight: bold;
    margin-bottom: $spacing-sm;
    @include text-title-xs;
}

.c-pricing-block-total {
    color: $color-vpn-brand-refresh-gray;
    font-weight: bold;
    margin-bottom: $spacing-2xl;
}

.c-pricing-block-horizontal {
    @media #{$mq-lg} {
        .mzp-l-columns {
            grid-gap: $v-grid-sm $h-grid-sm;
            gap: $v-grid-sm $h-grid-sm;
        }
    }

    @media #{$mq-xl} {
        .mzp-l-columns {
            grid-gap: $v-grid-lg $h-grid-xl;
            gap: $v-grid-lg $h-grid-xl;
        }
    }

    @supports (--css: variables) {
        @media #{$mq-lg} {
            .mzp-l-columns {
                grid-gap: var(--v-grid-sm) var(--h-grid-sm);
                gap: var(--v-grid-sm) var(--h-grid-sm);
            }
        }

        @media #{$mq-xl} {
            .mzp-l-columns {
                grid-gap: var(--v-grid-lg) var(--h-grid-xl);
                gap: var(--v-grid-lg) var(--h-grid-xl);
            }
        }
    }
}

// * -------------------------------------------------------------------------- */
// FAQ Section

.c-faq-section-heading {
    margin-bottom: $layout-xl;
    text-align: center;
    @include text-title-md;
}

.c-faq-item {
    border: 1px solid $color-black;
    margin-bottom: $spacing-xl;
    padding: $spacing-xl;
}

.c-faq-item-heading {
    &:hover {
        cursor: pointer;
    }

    h3 {
        margin-bottom: 0;
        @include bidi((
            (text-align, left, right),
        ));
        @include text-title-xs;
    }
}

.c-faq-item-detail {
    margin: $spacing-xl 0 0;
    @include bidi((
        (padding-right, $spacing-xl, padding-left, 0),
    ));
}

// * -------------------------------------------------------------------------- */
// Mobile only subscription CTA

// QR Code scanning instructions show on wide view ports only.
.vpn-pricing-desktop-instruction {
    background: $color-marketing-gray-20 url('/media/img/products/vpn/landing-refresh/icons/info.svg') no-repeat;
    border-radius: $border-radius-md;
    display: none;
    padding: $spacing-lg;
    @include bidi((
        (background-position, left $spacing-md center, right $spacing-md center),
        (padding-left, 60px, padding-right, $spacing-lg),
        (text-align, left, right),
    ));

    @media #{$mq-md} {
        display: block;
    }
}

// Steps for signing up on mobile.
.vpn-pricing-mobile-steps {
    counter-reset: vpn-mobile-step-counter;
    list-style: none;
    margin: $spacing-xl 0;

    li {
        counter-increment: vpn-mobile-step-counter;
        line-height: 40px;
        margin-bottom: $spacing-md;
        min-height: 40px;
        position: relative;
        @include bidi((
            (padding-left, 40px + $spacing-md, padding-right, 0),
            (text-align, left, right),
        ));

        span {
            display: inline-block;
            line-height: normal;
            vertical-align: middle;
        }

        &::before {
            background: $color-marketing-gray-20;
            border-radius: 100%;
            content: counter(vpn-mobile-step-counter);
            display: inline-block;
            font-weight: bold;
            height: 40px;
            line-height: 40px;
            margin-top: -20px;
            position: absolute;
            text-align: center;
            top: 50%;
            width: 40px;
            @include bidi((
                (left, 0, right, auto),
            ));
        }
    }

    li:nth-child(1)::before {
        background: $color-vpn-brand-refresh-purple-10;
    }

    @media #{$mq-md} {
        margin: $spacing-xl 0 $spacing-2xl;
    }
}

// QR Code image shown on wide view ports only.
.vpn-pricing-mobile-qrcode-wrapper {
    display: none;
    margin: 0 auto;
    max-width: 480px;
    position: relative;

    .vpn-pricing-mobile-qrcode-image {
        left: 29%;
        position: absolute;
        right: 29%;
        top: 30%;

        svg {
            height: auto;
            width: 100%;
        }
    }

    .vpn-pricing-qrcode-background {
        display: block;
        margin: 0 auto;
    }

    @media #{$mq-md} {
        display: block;
    }
}

// Devices image shown on small view ports only.
.vpn-pricing-devices-image {
    display: block;
    margin: 0 auto $spacing-lg;

    @media #{$mq-md} {
        display: none;
    }
}

// App store badges show on desktop devices.
.vpn-pricing-mobile-badges li {
    display: inline-block;
     padding-top: $spacing-sm;
}

// Download app buttons shown on Android and iOS devices.
.vpn-pricing-mobile-button {
    display: none;

    .ios-cta,
    .android-cta {
        display: none;
    }
}

// iOS platform detection logic.
html.ios {
    .vpn-pricing-mobile-badges {
        display: none;
    }

    .vpn-pricing-mobile-button {
        display: block;

        .ios-cta {
            display: inline-block;
        }
    }
}

// Android platform detection logic.
html.android {
    .vpn-pricing-mobile-badges {
        display: none;
    }

    .vpn-pricing-mobile-button {
        display: block;

        .android-cta {
            display: inline-block;
        }
    }
}

.vpn-pricing-mobile-unsupported-language {
    padding-top: 0;
    margin-top: -$spacing-2xl;
}

// Mobile subscription pricing display

.c-pricing-block-mobile-wrapper {
    margin-top: $spacing-2xl;

    @media #{$mq-xl} {
        display: grid;
        grid-gap: $spacing-lg;
        grid-template-columns: repeat(2, 1fr);
    }
}

.c-pricing-block-mobile {
    background: $color-marketing-gray-20;
    border-radius: $border-radius-md;
    margin-bottom: $spacing-lg;
    padding: $spacing-md;
    position: relative;
    @include bidi(((text-align, left, right),));
}

.c-pricing-block-mobile-tag {
    background: $color-vpn-brand-refresh-purple-20;
    border-radius: $border-radius-md;
    color: $color-white;
    display: inline-block;
    font-weight: bold;
    padding: $spacing-xs $spacing-md;
    @include text-body-sm;

    html[lang^='en'] & {
        text-transform: uppercase;
    }

    @media #{$mq-xl} {
        position: absolute;
        top: $spacing-md;
        @include bidi(((left, $spacing-md, right, auto),));
    }
}

.c-pricing-block-mobile-heading {
    border-bottom: 2px solid $color-black;
    padding-bottom: $spacing-md;
    @include text-title-xs;

    @media #{$mq-xl} {
        margin-top: $spacing-2xl;
    }
}

.c-pricing-block-mobile-sub-heading {
    margin-bottom: 0;
    @include text-title-xs;

    .vpn-monthly-price-display span {
        display: inline-block;
        font-weight: normal;
        @include bidi(((margin-left, 0.2em, margin-right, 0),));
        @include text-body-md;
    }
}

.c-pricing-block-mobile-currency-info {
    margin: $spacing-lg 0 0;
    @include text-body-sm;
}

.c-pricing-block-mobile-total {
    color: $color-vpn-brand-refresh-gray;
    font-weight: bold;
    margin: $spacing-lg 0 0;
}
